<?php
 
namespace App\Http\Controllers;

use App\Http\Controllers\BaseController;
use App\Services\CulturalHeritageService;
use Illuminate\Http\Request;
 
class CulturalHeritageController extends BaseController
{
    public function __construct(CulturalHeritageService $culturalHeritageService) 
    {
        $this->culturalHeritageService = $culturalHeritageService;
    }

    public function index()
    {
        $param = $this->validationParameter([
            'page|页码' => 'noRequire|number|default:1',
            'per_page|显示数量' => 'noRequire|number|default:30',
            'keyword|搜索条件' => 'noRequire',
            'type|非遗类型' => 'noRequire',
        ]);

        $data = $this->culturalHeritageService->getList($param);
        
        return $this->response->success($data);
    }

    public function show(Request $request)
    {
        $id = $request->input('id');
        $result = $this->culturalHeritageService->getInfo($id);
 
        return $this->response->success($result);
    }

    public function home(Request $request)
    {
        $result = $this->culturalHeritageService->home();

        return $this->response->success($result);
    }
 
    
}